package both;

import client.*;
import server.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.xml.bind.JAXBException;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author twoodf5611
 */
public class GameCommTester implements ActionListener {
	public static void main(String[] args) throws UnknownHostException, SocketException, JAXBException {
    	new GameCommTester().go();
	}
    
	public void go() throws UnknownHostException, SocketException, JAXBException {
    	Game funGame = new Game();
    	GameShowServer srv = new GameShowServer(); 
    	srv.setGame(funGame);
    	srv.setClientOutputFolder("Z:/srv/cli");
    	srv.setServerOutputFolder("Z:/srv/srv");
    	srv.addRegistrationListener(this);
    	//GameShowClient cli = new GameShowClient();
    	//cli.setClientOutputFolder("Z:/srv/cli");
    	//cli.setServerOutputFolder("Z:/srv/srv");
    	//cli.addListener(this);
    	//cli.startListening();
    	//Contestant snd = new Contestant();
    	//snd.setName("name");
    	//snd.setTeamName("team");
    	//cli.sendRegistration(snd);
    	Question qtest = new Question();
    	qtest.setQuestionText("Is true true or false?");
    	ArrayList<String> choices = new ArrayList<String>();
    	choices.add("True");
    	choices.add("False");
    	qtest.setAnswerChoices(choices);
    	qtest.setCorrectAnswer(0);
    	qtest.setPointValue(5);
    	qtest.setExplanation("Yes");
    	qtest.setTime(3);
    	ArrayList<Question> qlist = new ArrayList<Question>();
    	qlist.add(qtest);
    	funGame.setQuestionList(qlist);
    	//srv.sendQuestion(0);
        JFrame frame = new JFrame("test");
        frame.add(new ScoreboardTab(srv));
        frame.setVisible(true);
        frame.pack();
	}

	@Override
	public void actionPerformed(ActionEvent ae) {
   	System.out.println(ae);
	}
}


